/**
 * 
 */
package br.com.ufrn.aipetro.ga.domain.entity.stock;

import br.com.ufrn.aipetro.ga.domain.entity.interfaces.AbstractModel;
import br.com.ufrn.aipetro.ga.domain.entity.manufacturer.Manufacturer;

/**
 * @author Lucas
 *
 */
public class Part extends AbstractModel {
	
	public static final String ID_TB_PART_PROPERTY = "idTbPart";
	public static final String DESCRIPTION_PROPERTY = "description";
	public static final String MANUFACTURER_PROPERTY = "manufacturer";
	public static final String MODEL_PROPERTY = "model";
	public static final String QUANTITY_PROPERTY = "quantity";
	public static final String PRICE_PROPERTY = "price";
	
	private Integer idTbPart;
	private String description;
	private Manufacturer manufacturer;
	private String model;
	private double quantity;
	private double price;
	
	/**
	 * 
	 */
	public Part() {
	}

	/**
	 * @param description
	 * @param manufacturer
	 * @param model
	 * @param quantity
	 * @param price
	 */
	public Part(String description, Manufacturer manufacturer, String model,
			double quantity, double price) {
		this.description = description;
		this.manufacturer = manufacturer;
		this.model = model;
		this.quantity = quantity;
		this.price = price;
	}

	/**
	 * @return the idTbPart
	 */
	public Integer getIdTbPart() {
		return idTbPart;
	}

	/**
	 * @return the description
	 */
	public String getDescription() {
		return description;
	}

	/**
	 * @return the manufacturer
	 */
	public Manufacturer getManufacturer() {
		return manufacturer;
	}

	/**
	 * @return the model
	 */
	public String getModel() {
		return model;
	}

	/**
	 * @return the quantity
	 */
	public double getQuantity() {
		return quantity;
	}

	/**
	 * @return the price
	 */
	public double getPrice() {
		return price;
	}

	/**
	 * @param idTbPart the idTbPart to set
	 */
	public void setIdTbPart(Integer idTbPart) {
		Integer oldIdTbPart = this.idTbPart;
		this.idTbPart = idTbPart;
		
		firePropertyChange(ID_TB_PART_PROPERTY, oldIdTbPart, idTbPart);
	}

	/**
	 * @param description the description to set
	 */
	public void setDescription(String description) {
		String oldDescription = this.description;
		this.description = description;
		
		firePropertyChange(DESCRIPTION_PROPERTY, oldDescription, description);
	}

	/**
	 * @param manufacturer the manufacturer to set
	 */
	public void setManufacturer(Manufacturer manufacturer) {
		Manufacturer oldManufacturer = this.manufacturer; 
		this.manufacturer = manufacturer;
		
		firePropertyChange(MANUFACTURER_PROPERTY, oldManufacturer, manufacturer);
	}

	/**
	 * @param model the model to set
	 */
	public void setModel(String model) {
		String oldModel = this.model;
		this.model = model;
		
		firePropertyChange(MODEL_PROPERTY, oldModel, model);
	}

	/**
	 * @param quantity the quantity to set
	 */
	public void setQuantity(double quantity) {
		double oldQuantity = this.quantity;
		this.quantity = quantity;
		
		firePropertyChange(QUANTITY_PROPERTY, oldQuantity, quantity);
	}

	/**
	 * @param price the price to set
	 */
	public void setPrice(double price) {
		double oldPrice = this.price;
		this.price = price;
		
		firePropertyChange(PRICE_PROPERTY, oldPrice, price);
	}
	
}
